package com.demo.bigdata

import org.apache.spark.{SparkConf, SparkContext}

object FlatMapDemo {
  def main(args: Array[String]): Unit = {
    val conf = (new SparkConf).setMaster("local").setAppName("Demo");
    val sc = new SparkContext(conf)
    val lines = sc.parallelize(List("Hadoop in action","Learning spark"))
    val res = lines.flatMap(_.split(" "))
    res.foreach(println(_))
  }
}
